package com.dabbo.starship.app.text.client;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import com.dabbo.starship.interfaces.ServerCommand;

public class TestServerShutdown {

	public static void main(String[] args) {

		Registry registry;
		ServerCommand sc;
		
		try {
			registry = LocateRegistry.getRegistry("localhost", 3233);
			sc = (ServerCommand) registry.lookup("cmd");
			System.out.println("Current Command : " + sc.getCommand());
			sc.setCommand(ServerCommand.CMD_SHUTDOWN);
			System.out.println("Server termination signal sent.");
			System.out.println("Updated Command : " + sc.getCommand());
		} catch (Exception ex) {
			System.out.println("Fatal exception occurred.");
		}
		
		
	}

}
